/******************************************************************************
 * (c) 2011 Komersi Software                                                  *
 * www.komersisoftware.com                                                    *
 *                                                                            *
 * This file is part of Tadah                                                 *
 * Licensed under GNU General Public License v2.0                             *
 * Check LICENSE.TXT for more information                                     *
 ******************************************************************************/

#ifndef _TABLEINFO_H_
#define _TABLEINFO_H_

#include "ddl.h"
#include "definitions.h"
#include "primaryindex.h"

typedef struct table_info
{
    char name[TABLE_NAME_LENGTH + sizeof(char)];
    char table_filename[TABLE_NAME_LENGTH + 5 * sizeof(char)];
    char ddl_filename[TABLE_NAME_LENGTH + 5 * sizeof(char)];
    char primary_index_filename[TABLE_NAME_LENGTH + 5 * sizeof(char)];

    ddl_column_t *column_list;
    primary_index_info_t *primary_index;
} table_info_t;

table_info_t *load_table_info(char *name);
table_info_t *new_table_info(char *name);

void dispose_table_info(table_info_t **object);
int set_primary_index(table_info_t *table, ddl_column_t *column);
ddl_column_t *get_primary_index(table_info_t *table);

int create_table(table_info_t *table_info);

#endif //_TABLEINFO_H_
